﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	xmlns:tfs="clr-namespace:Microsoft.TeamFoundation.Controls.WPF;assembly=Microsoft.TeamFoundation.Controls"
	xmlns:tfsvc="clr-namespace:Microsoft.TeamFoundation.VersionControl.Client;assembly=Microsoft.TeamFoundation.VersionControl.Client"
	xmlns:merge="clr-namespace:TeamExplorer.Merge.MergeCandidates"
	xmlns:converter="clr-namespace:Microsoft.TeamFoundation.Controls.WPF.Converters;assembly=Microsoft.TeamFoundation.Controls"
	xmlns:doc="clr-namespace:System.Windows.Documents;assembly=PresentationFramework"
	xmlns:TeamExplorer="clr-namespace:Microsoft.TeamFoundation.Controls.WPF.TeamExplorer;assembly=Microsoft.TeamFoundation.Controls" 
	xmlns:Framework="clr-namespace:Microsoft.TeamFoundation.Controls.WPF.TeamExplorer.Framework;assembly=Microsoft.TeamFoundation.Controls"
	xmlns:this="clr-namespace:TeamExplorer.Merge.MergeCandidates"
	x:Class="TeamExplorer.Merge.MergeCandidates.MergeCandidatesDetailsPageView"
	mc:Ignorable="d" 
	d:DesignHeight="300" d:DesignWidth="300"
	>
	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary x:Uid="VSResourceDictionary"
							Source="pack://application:,,,/Microsoft.TeamFoundation.Controls;component/WPF/SharedResources.xaml"/>
			</ResourceDictionary.MergedDictionaries>

			<converter:TrueToVisibleConverter x:Key="Converters.TrueToVisibility" />
			<ObjectDataProvider ObjectType="{x:Type this:DesignMergeCandidatesDetailsPage}" x:Key="DesignTimeDataSource" d:IsDataSource="True"/>

			<Style x:Key="Styles.ResultRow" TargetType="{x:Type Grid}">
				<Setter Property="Height" Value="40" />
				<Setter Property="Margin" Value="0,2,0,0" />
				<Setter Property="Background" Value="Transparent" />
			</Style>
			<Style x:Key="Styles.LargeNumberFailure" TargetType="{x:Type TextBlock}">
				<Setter Property="FontSize" Value="11pt" />
				<Setter Property="Margin" Value="0,5,4,5" />
			</Style>
			<Style x:Key="Styles.LargeNumberInfo" TargetType="{x:Type TextBlock}">
				<Setter Property="FontSize" Value="11pt" />
				<Setter Property="Margin" Value="0,5,4,5" />
			</Style>
			<Style x:Key="Styles.ResultBarTitleFailure" TargetType="{x:Type TextBlock}">
				<Setter Property="FontSize" Value="11pt" />
				<Setter Property="Margin" Value="5,2" />
				<Setter Property="VerticalAlignment" Value="Center" />
			</Style>
			<Style x:Key="Styles.ResultBarTitleInfo" TargetType="{x:Type TextBlock}">
				<Setter Property="FontSize" Value="11pt" />
				<Setter Property="Margin" Value="5,5,4,5" />
				<Setter Property="VerticalAlignment" Value="Center" />
			</Style>
			<Style x:Key="Styles.TitleText" TargetType="{x:Type TextBlock}">
				<Setter Property="FontSize" Value="11pt" />
				<Setter Property="Margin" Value="5,2" />
			</Style>
			<Style x:Key="Styles.InformationText" TargetType="{x:Type TextBlock}">
				<Setter Property="HorizontalAlignment" Value="Left" />
				<Setter Property="FontSize" Value="11pt" />
				<Setter Property="Margin" Value="5,1,1,1" />
				<Setter Property="TextWrapping" Value="Wrap" />
			</Style>
			<Style x:Key="Styles.InformationHeader" TargetType="{x:Type TextBlock}">
				<Setter Property="Width" Value="35" />
				<Setter Property="HorizontalAlignment" Value="Left" />
				<Setter Property="FontSize" Value="9pt" />
				<Setter Property="Margin" Value="5,1,1,1" />
			</Style>
			<Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource ListBoxItemStyle}" />
		</ResourceDictionary>
	</UserControl.Resources>

	<Grid d:DataContext="{StaticResource DesignTimeDataSource}">
		<StackPanel Margin="1,5">
			<StackPanel Orientation="Horizontal">
				<TextBlock Text="Changeset:" Style="{StaticResource Styles.TitleText}" />
				<TextBlock Text="{Binding ChangesetId,Mode=OneWay, FallbackValue=10384}" Style="{StaticResource Styles.TitleText}" />
			</StackPanel>
			<StackPanel Orientation="Horizontal">
				<TextBlock Text="From:" Style="{StaticResource Styles.InformationHeader}" />
				<TextBlock Text="{Binding SourceBranch,Mode=OneWay, FallbackValue='$/Team Explorer Merge/trunk'}" Style="{StaticResource Styles.InformationText}" />
			</StackPanel>
			<StackPanel Orientation="Horizontal">
				<TextBlock Text="To:" Style="{StaticResource Styles.InformationHeader}" />
				<TextBlock Text="{Binding TargetBranch,Mode=OneWay, FallbackValue='$/Team Explorer Merge/v1'}" Style="{StaticResource Styles.InformationText}" />
			</StackPanel>

			<Framework:SectionControl 
				x:Name="_getSection"
				Margin="0,10,0,0"
				HeaderText="Get Operation" 
				IsSectionEmpty="False"
				IsBusy="{Binding IsGetOperationBusy,Mode=OneWay}">
				<Framework:SectionControl.Content>
					<StackPanel>
						<Grid Style="{StaticResource Styles.ResultRow}">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>
							<TextBlock 
								Style="{StaticResource Styles.ResultBarTitleFailure}"                                
								Text="Failures" />
							<TextBlock
								Grid.Column="1" 
								HorizontalAlignment="Right" 
								Style="{StaticResource Styles.LargeNumberFailure}"
								Text="{Binding NumFailures, Mode=OneWay}" />
						</Grid>
							<ListBox 
								ItemsSource="{Binding Failures}"
								ScrollViewer.HorizontalScrollBarVisibility="Auto"
								BorderThickness="0"
								ScrollViewer.VerticalScrollBarVisibility="Auto"
								HorizontalContentAlignment="Left"
								VerticalContentAlignment="Stretch">
								<ListBox.Style>
									<Style TargetType="{x:Type ListBox}">
										<Style.Triggers>
											<DataTrigger Binding="{Binding NumFailures}" Value="{x:Null}">
												<Setter Property="Visibility" Value="Collapsed" />
											</DataTrigger>
											<DataTrigger Binding="{Binding NumFailures}" Value="0">
												<Setter Property="Visibility" Value="Collapsed" />
											</DataTrigger>
										</Style.Triggers>
									</Style>
								</ListBox.Style>
								<ListBox.ItemTemplate>
									<DataTemplate>
										<Grid>
											<TextBlock Text="{Binding Message}" TextWrapping="Wrap" />
										</Grid>
								</DataTemplate>
								</ListBox.ItemTemplate>
							</ListBox>
						<Grid Style="{StaticResource Styles.ResultRow}">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>
							<TextBlock 
							Style="{StaticResource Styles.ResultBarTitleInfo}"
							Text="Warnings" />
							<TextBlock
							Grid.Column="1" 
							HorizontalAlignment="Right" 
							Style="{StaticResource Styles.LargeNumberInfo}"
							Text="{Binding NumWarnings, Mode=OneWay, FallbackValue=1}" />
						</Grid>
						<Grid Style="{StaticResource Styles.ResultRow}">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>
							<TextBlock 
							Style="{StaticResource Styles.ResultBarTitleInfo}"
							Text="Conflicts" />
							<TextBlock
								Grid.Column="1" 
								HorizontalAlignment="Right" 
								Style="{StaticResource Styles.LargeNumberInfo}"
								Text="{Binding NumConflicts, Mode=OneWay, FallbackValue=10}" />
						</Grid>

					</StackPanel>
				</Framework:SectionControl.Content>
			</Framework:SectionControl>
			<Framework:SectionControl 
				x:Name="_checkinSection" 
				Height="300" 
				IsSectionEmpty="False" 
				HeaderText="Checkin Operation"
				IsBusy="{Binding IsCheckinOperationBusy, Mode=OneWay}">
				<Framework:SectionControl.Content>
					<StackPanel>
						<Grid Style="{StaticResource Styles.ResultRow}">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>
							<TextBlock 
							Style="{StaticResource Styles.ResultBarTitleFailure}"                            
							Text="Policy Failures" />
							<TextBlock
								Grid.Column="1" 
								HorizontalAlignment="Right" 
								Style="{StaticResource Styles.LargeNumberFailure}"
								Text="{Binding NumPolicyFailures, Mode=OneWay, FallbackValue=0}" />
						</Grid>
						<ListBox 
							ItemsSource="{Binding PolicyFailures}"
							ScrollViewer.HorizontalScrollBarVisibility="Hidden"
							BorderThickness="0"
							ScrollViewer.VerticalScrollBarVisibility="Auto"
							HorizontalContentAlignment="Left"
							VerticalContentAlignment="Stretch">
							<ListBox.Style>
								<Style TargetType="{x:Type ListBox}">
									<Style.Triggers>
										<DataTrigger Binding="{Binding NumPolicyFailures}" Value="{x:Null}">
											<Setter Property="Visibility" Value="Collapsed" />
										</DataTrigger>
										<DataTrigger Binding="{Binding NumPolicyFailures}" Value="0">
											<Setter Property="Visibility" Value="Collapsed" />
										</DataTrigger>
									</Style.Triggers>
								</Style>
							</ListBox.Style>
							<ListBox.ItemTemplate>
								<DataTemplate>
									<Grid>
										<Grid.RowDefinitions>
											<RowDefinition />
											<RowDefinition />
										</Grid.RowDefinitions>
										<TextBlock Text="{Binding PolicyName}" FontWeight="Bold" />
										<TextBlock Text="{Binding Message}" Grid.Row="1" TextWrapping="Wrap" />
									</Grid>
								</DataTemplate>
							</ListBox.ItemTemplate>
						</ListBox>
					</StackPanel>
				</Framework:SectionControl.Content>
			</Framework:SectionControl>
		</StackPanel>
	</Grid>
</UserControl>
